package com.xihu.socielserver.controller;

import com.xihu.socielserver.service.ResourcerecyclingBiz;
import com.xihu.socielserver.entity.ResourceRecycling;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin("*")
@Controller
@RequestMapping("/resource_recycling")
public class ResourcerecyclingController {
    @Autowired
    private ResourcerecyclingBiz biz;

    @RequestMapping("/show")
    @ResponseBody
    public Map list(){
        List<ResourceRecycling> list = biz.getResource();
        Map map = new HashMap();
        if(list != null){
            map.put("isOk",true);
            map.put("resource_recycling",list);
            map.put("msg","展示成功");
        }else{
            map.put("isOk",false);
            map.put("resource_recycling", list);
            map.put("msg", "目前没有活动！");
        }
        return map;
    }
}
